﻿@using Kugar.AdminLte.Core.Test.Models.Home
@using Kugar.Core.ExtMethod
@using Kugar.UI.Web.AdminLTE.Enums
@using Kugar.UI.Web.AdminLTE.Helpers
@using Kugar.UI.Web.AdminLTE.PageControls.PageCommon
@model Kugar.AdminLte.Core.Test.Models.Home.Model_List

@{
    Layout = null;
}

@using (WebUI.Control.ModalWindow().ID("ModalList").Title("ModalList").ContentWidth(1200).ContentHeight(800).Render())
{
    using (var dl = WebUI.Control.DataList<TableTest>().Render())
    {
        dl.FilterBlock.ColQty(QueryBoxColCount.Col_4).HideQueryButton().UpdateElementID("ModalList").Get("/Home/ModalList")
            .AddSelector(x => x.BoxItemLabel("selector").Name("levelOne").Options(new[]
            {
                new SelectorItem("000", "0"),
                new SelectorItem("001", "1"),
                new SelectorItem("002", "2")
            }).FirstItem("全部", "-1").CurrentValue(2))

            .AddDateTimeRange(x => x.BoxItemLabel("daterange").Name("sDT", "eDT").Value(null, null))
            
            .AddTextBoxWithButton(x => x.BoxItemLabel("keyword").Name("keyword").SelectedOnClick().ButtonType(ButtonTypeEnum.submit).ButtonText("search").ButtonIconCss(""))

            .Render();

        using (var db = dl.DataBlock.Render())
        {
            using (var tbl = db.Table.Data(Model.Data).AjaxPager("ModalList").LeftFixedColumn(1).PagerShowFirstLast().NoWrap().Render())
            {
                @tbl.Columns.AddIndex()

                @tbl.Columns.AddLabel().ColumnTitle("UserName1").Value(x => x.UserName1)

                @tbl.Columns.AddLabel().ColumnTitle("UserName2").Value(x => x.UserName2)

                @tbl.Columns.AddLabel().ColumnTitle("UserName3").Value(x => x.UserName3.ToStringEx("yyyy-MM-dd"))

                @tbl.Columns.AddLabel().ColumnTitle("UserName4").Value(x => x.UserName4.ToString())

                @tbl.Columns.AddLabel().ColumnTitle("UserName5").Value(x => x.UserName5)

                @tbl.Columns.AddLabel().ColumnTitle("UserName6").Value(x => x.UserName6)

                @tbl.Columns.AddLabel().ColumnTitle("UserName7").Value(x => x.UserName7)

                @tbl.Columns.AddLabel().ColumnTitle("UserName8").Value(x => x.UserName8)
            }
        }
    }
}